The Bird Scanner Workflow

Jack Kauphusman

2023-04-27

1. Introduction

\(~\)

This document was inspired by noticing the convergence of artificial intelligence with ecological research and the ground breaking development of the BirdNET algorithm developed by Dr. Stefan Kahl with the K. Lisa Yang Center for Conservation Bioacoustics at the Cornell Lab of Ornithology. BirdNET Paper.

\(~\)

Birdnet is an machine learning model developed using the tensorflow algorithm, which is a software library developed by Google to be used to develop AI models that can make predictions based on a large dataset of pre-trained data. Birdnet is trained based on hundreds of thousands of bird calls from Cornell Lab of Ornithology across various species, and can provide predictions for around 3,000 bird calls worldwide (as of 2023). To simply put it, if you have an audio file with various bird calls, BirdNET can be used to identify which species are calling in the given audio-file, at which time of the audio, and to what degree it believes that species to be. If you think you want to have this software available, this document is going to show you the steps I have developed to streamline a weeks worth of audio files to be processed to see which species occur in a given area.

\(~\)

Now, before I explain my process, I want to highlight some alternatives that can be done with BirdNET. BirdNET was developed in Python, therefore, if you have a real foundation in the Python language, I encourage you to explore Dr. Kalh’s github repository. In the github repo, Dr, Kahl explains how one would set up the python environment and run the model through either Ubuntu or Windows. There is an option to use a GUI he developed to run BirdNET on your audio files, but if you want to run multiple files with one command, compile the results into one table, and have validation tools to check predictions, I encourage you to explore my option. Finally, within Dr. Kahl’s github repository, he provides other projects that have used BirdNET to identify birds in real time from ARU units.The only issue with these projects is that they require LTE connectivity, therefore, not the greatest help for a typical biological ARU survey.

\(~\)

If you have decided to go through my alternative framework on how I have been using BirdNET for both species investigation and potential incorporation to ESA surveys, below I will run a step-by-step process from recording the data from the field to processing the audios on my Windows Laptop.

\(~\)

The only pre-requisites required for my framework is a general understanding of the R language and Git, which for most young biologists that have went through Graduate School, should have a fundamental understanding. If you are one who is not familiar with R & Rstudio, I suggest you watch this quick video..

2. The Framework

\(~\)

\(~\)

  1. Deploy Autonomous Recording Units (ARUs) into the field of study.

  2. Download the audio recordings to the computer, and convert the wav and/or mp3 files to “SITEID_YYYYMMDD_HHMMSS” format.

  3. Set-up BirdNET with the NSNSDAcoustics package developed by Cathleen Balantic with the National Parks Service.

  4. Run your modified version of the “bird_scanner.R” R script from the Bird-Scanner Repository.

  5. Check predictions using the “bird-checker.R” script

3. Deploying ARUs

An autonomous recording unit, otherwise known as an ARU, is a self-contained audio recording device that is deployed in marine or terrestrial environments for bioacoustic monitoring. The unit is used in both marine and terrestrial environments to track the behavior of animals, identify sensitive species occurring in an area, gauge habitat quality, and monitor the ecosystems.

\(~\)

Within the last two decades, ARUs have been growing in popularity for use in studies on birds, cetaceans, primates, bats, anurans, and insects. However, for most of the history of deploying these ARUs into the field, would require costly (>$1,000) units and long hours of downloading and processing the audio data into distilling down where species were calling based on known experience of species specific calls.

\(~\)

With the advancements in the bioacoustic industry today, and manufacturing overall, the costs associated with ARUs has drastically decreased for the entry-level devices (<$300). The three big players of the bioacoustic ARUs that I recommend using are Wildlife Accoustics, Open Acoustics Audiomoths, and SwiftOne by Cornell Labs.

\(~\)

My firm has obtained two ARU devices that I would recommend as a staring point with Bird-Scanner; the Audiomoth v1.2.0, which is a relatively cheap (<$150) audio device that has a bit of a learning curve, but was my go to device for deployment for the entire 2022 field season.

\(~\)

\(~\)

The other device was from Wildlife Acoustics: Song Meter Micro, which was simple to set up and has an app to configure the recording times. The device retails for $250, which is a bump up in price compared to the Audiomoth, however, these devices are backed by a greatly reputable company.

\(~\)

\(~\)

For this walk through on Bird-Scanner, I deployed an ARU in my backyard under my bird feeder, which was set up to start recording from 6:00 - 19:00 and recorded a 5 minute segment of audio every 15 minutes, which equates to 52 wav files for the day. At the end of a recording session, at the birdfeeder, I walked out to the device, popped it open, then removed the SD card, and plugged the card into my laptop.

\(~\)

\(~\)

Currently, I have only deployed Bird-Scanner at 12 locations across the Navajo Nation during habitat assessment surveys to assist in determining species that occur within or near the project area. So far Bird-Scanner has improved my detection ability of birds for my project (which, are the addition of birds identified by Bird-Scanner from the birds I am observing while conducting the survey) reports by 25%.

4. Download Audio Data

To download the wav files from the ARU, plug the micro-SD card from the device into your computer, and transfer the files over into a folder of your choice (personally, I have a folder in my Documents folder that holds all my recordings based on each recording effort). Another alternative would be to save them under the data folder in the Bird-Scanner repository (refer to section 5).

\(~\) EX:) C:\Users\jkauphusman\Documents\Recordings\Birdfeeder \(~\)

Now, to run Bird-Scanner, you need to rename your files into this format SITEID_YYYYMMDD_HHMMSS, likely based on the device you are using your files should already include the date metadata format (ex: 20220806_140730) or if you are using the Wildlife Acoustic Mini your files will already be labeled like this SMM07526_20221213_090202.wav. To run Bird-Scanner, it is important that each file has a site label followed by the date, otherwise the bird_scanner.R script will not run. If your files are labeled the Wildlife Acoustic format proceed to the next step, otherwise, you will need to implement a site label (ex: Birdfeeder_20220806_140730.wav). If you don’t want to sit and rename each wav file, I have a script I developed in this repository ./code/file_renamer.R which should give you a great jumping off point to auto-rename the files to your liking.

5. BirdNET and NSNSDAcoustics

To set up BirdNET on your laptop, the minimum requirements you will need is a general understanding of conda environments and how they interact with r-reticulate package, which I will walk you through. I will try to make this process as simple as possible, but reach out to me if you get stuck. One of the issues with BirdNET is that it will only run results on one file at a time, must be run in terminal, and lacks the data management power that R clearly has the edge over. So to bring the best of both worlds, I chose to develop my workflow with R leveraging the great NSNSDA Acoustics R package.

Below, I will show you my process on how to set up BirdNET to run with this repository, but I highly suggest you to read through the NSNSDAcoustics package tutorial information since we will be heavily using this package to run BirdNET on our recordings.

\(~\)

A) First, you will need to download the BirdNET Analyzer Repository, unsure how to do that, click the “Code” button on the repository’s github page and then select download zip. From there just drag and unzip the folder into your documents folder. Warning you must have this file in your documents folder on your pc for this workflow to run properly with the NSNSDAcoustics package.

\(~\)

\(~\)

From there place the BirdNet Analyzer folder into your documents folder on your computer

C:\Users\Username\Documents\

B) Go ahead and download Anaconda for Windows. Following the download you will need to open the “Anaconda Prompt” terminal.

In the terminal run the following commands:

conda create -n pybirdanalyze python=3.7

This creates the conda environment to run BirdNET

conda activate pybirdanalyze

This will activate the conda environment

pip install --upgrade pip

This will create an installer to install the needed BirdNET extensions more smoothly

pip install tensorflow pip install librosa pip install numpy==1.20

Those last few commands will download the extensions so that we can start running BirdNET

\(~\)

C) Now we need to move to files from the BirdNET folder to the conda environment.

Open up the BirdNET-Analyzer folder and copy two files

  • the checkpoints folder
  • eBird_taxonomy_codes_2021E.json file

From there, open up the conda environment folder, the path should be something like this

C:\Users\Username\Anaconda3\envs\pybirdanalyze

\(~\)

And with that you should be done with the hardest part of setting up Bird-Scanner.

D) Download or git clone the Bird-Scanner Repository.

If you do not understand github and its uses with R watch this quick video.

I would recommend downloading bird-scanner into you documents folder. From there, open RStudio and open the Bird_Scanner.Rproj.

In the repository, under the “code” folder open the “setup_env.R” file and change the paths for the

Sys.setenv(RETICULATE_PYTHON = "C:/Users/jkauphusman/Anaconda3/envs/pybirdanalyze/python.exe")

and

birdnet_model <- "C:/Users/JKauphusman/OneDrive - Logan Simpson/Documents/BirdNET-Analyzer-main"

to the paths on your computer, based on your username, of where your conda env and BirdNet Analyzer folders are located. Then run the script (hint you need to install the following R packages if you have not already). Remember to keep this “setup_env.R” script within your repository so you can call to it when you run “bird_scanner.R”.

Now install the following packages so that you have no issues with the Bird-Scanner-Workflow:

install.packages(c("reticulate", "tidyverse", "devtools", "glue", "openxlsx", "readxl", "tuneR", "ggplot2", "umap", "seewave", "phonTools", "signal", "warbleR"))

Now run the following commands to download the NSNSDAcoustics r package

library(devtools) devtools::install_github('nationalparkservice/NSNSDAcoustics')

If there are no errors, you should be able to run the bird_scanner.R script.

6. Run Bird-Scanner

Below, is an example and tutorial to show you how Bird-Scanner is operated following the collection of audio files from your deployed ARU. When I run my calls following a field session, I will use the bird_scanner.R script, found within the code folder of the Bird-Scanner Repository, which will auto-ID bird calls within the recordings, and output the results in a excel table format that will include: species, time of call, model prediction percentage, and when in the recording the model heard the call. For each session with bird_scanner.R all I change is the filepaths, location information, and confidence thresholds.

\(~\) If you remember at this point of the workflow, we have collected audio files at my bird feeder and loaded the wav files to my computer. After that we verified the files were named in the proper format SITEID_YYYYMMDD_HHMMSS.

Here is an example of one of those recordings at the bird-feeder:

\(~\)

Lets look at how the file names of the recordings should look like:

files <- list.files("./data/", recursive = TRUE, full.names = FALSE)
file_names <- data.frame(files[1:5])
knitr::kable(file_names, format = "html", caption = "Recording Filenames")
Recording Filenames
files.1.5.
SMM07526_20221213_090202.wav
SMM07526_20221213_090402.wav
SMM07526_20221213_100000.wav
SMM07526_20221213_100202.wav
SMM07526_20221213_100402.wav

As you can see, the files are in the needed format: SITEID_YYYYMMDD_HHMMSS, but with my Song Meter Micro, I have the ARUs name (SMM07526) instead of the site name, but it should run the model fine with no issue.

Referring to the bird-scanner.R script, I will walk through the necessary steps to run BirdNET on our gathered recordings.

First, run the setup_env.R script and then load in the filepath and designate an output folder. The setup_env.R script is needed to activate your conda environment. If you are confused with the glue() function, it essentially pastes in text based on the saved object with the {}. So below if I run

data <-glue("{path}data) it saves data as “C:/Users/jkauphusman/Desktop/Scripts/Bird_Scanner/data”, which for this tutorial all my wav files are saved under the data folder in the Bird-Scanner Repository.

Anywho, lets run the following code:

# Load in the Birdnet conda environment
source("./code/setup_env.R")
# set the file path
path <- "C:/Users/jkauphusman/Desktop/Scripts/Bird_Scanner/"
# Load in the file path of where the data is located, you will need the entire path
data <- glue("{path}data")
# Designate the output folder
output <- glue("{path}", "results-directory")

Now, you need to identify where your ARUs were deployed, which the coordinates will need to be in lat-long format. The BirdNET model will use these coordinates to reduce the amount of species it can use to predict based on the range data for birds identified by the Cornell Labs of Ornithology and eBird.

latitude <- 33.273595
longitude <- -111.829824

Another prerequisite is to define the confidence threshold that you want BirdNet to abide to. There are various strengths and weaknesses for a higher or lower threshold, so if you want to reduce false positives or false negatives based on your analysis you’ll need to decide what threshold is best for you. I have designated 70% to decrease false positives so that when the model is making a prediction it is very accurate.

conf <- 0.75

With those prerequisites out of the way, we can run the audio files through the BirdNET Model.

birdnet_analyzer(audio.directory = data,
                 results.directory = output,
                 birdnet.directory = birdnet_model,
                 use.week = TRUE,
                 lat = latitude,
                 lon = longitude,
                 min.conf = conf)

One item that is important to review following the results from BirdNET is the pool of potential species the model is predicting from based on the distribution information of avian species that occur in a given area, which is pre-trained into BirdNet from eBird and Cornell Labs information. Run the following code to extract the specific species list used during the BirdNet run based on the coordinates provided. Here are the potential species that can occur by my bird feeder (i.e., the greater Phoenix, AZ area). FYI, this is a long list so you can scroll really fast to the next code chunk.

source("./code/species_list.R")
spec_list <- spec_list()
spec_list
##                     scientific_name                   common_name
## 1              Haemorhous mexicanus                   House Finch
## 2                      Corvus corax                  Common Raven
## 3               Callipepla gambelii                Gambel's Quail
## 4                  Zenaida macroura                 Mourning Dove
## 5            Zonotrichia leucophrys         White-crowned Sparrow
## 6               Auriparus flaviceps                        Verdin
## 7                Setophaga coronata         Yellow-rumped Warbler
## 8            Melanerpes uropygialis               Gila Woodpecker
## 9                     Sayornis saya                  Say's Phoebe
## 10               Leiothlypis luciae                Lucy's Warbler
## 11             Amphispiza bilineata        Black-throated Sparrow
## 12                 Zenaida asiatica             White-winged Dove
## 13               Phainopepla nitens                   Phainopepla
## 14                Buteo jamaicensis               Red-tailed Hawk
## 15            Toxostoma curvirostre         Curve-billed Thrasher
## 16                  Spinus psaltria              Lesser Goldfinch
## 17            Myiarchus cinerascens       Ash-throated Flycatcher
## 18                   Junco hyemalis               Dark-eyed Junco
## 19              Quiscalus mexicanus          Great-tailed Grackle
## 20               Dryobates scalaris      Ladder-backed Woodpecker
## 21                 Fulica americana                 American Coot
## 22                  Melozone aberti                Abert's Towhee
## 23                Passer domesticus                 House Sparrow
## 24                 Colaptes auratus              Northern Flicker
## 25              Corthylio calendula          Ruby-crowned Kinglet
## 26               Sayornis nigricans                  Black Phoebe
## 27                Mimus polyglottos          Northern Mockingbird
## 28               Spizella passerina              Chipping Sparrow
## 29                   Molothrus ater          Brown-headed Cowbird
## 30  Campylorhynchus brunneicapillus                   Cactus Wren
## 31            Streptopelia decaocto        Eurasian Collared-Dove
## 32                     Calypte anna            Anna's Hummingbird
## 33              Tyrannus verticalis              Western Kingbird
## 34               Cardellina pusilla              Wilson's Warbler
## 35              Polioptila melanura      Black-tailed Gnatcatcher
## 36                 Falco sparverius              American Kestrel
## 37              Lanius ludovicianus             Loggerhead Shrike
## 38               Setophaga petechia                Yellow Warbler
## 39              Thryomanes bewickii                 Bewick's Wren
## 40             Pyrocephalus rubinus          Vermilion Flycatcher
## 41              Melospiza lincolnii             Lincoln's Sparrow
## 42                 Spizella breweri              Brewer's Sparrow
## 43              Piranga ludoviciana               Western Tanager
## 44             Charadrius vociferus                      Killdeer
## 45               Leiothlypis celata        Orange-crowned Warbler
## 46               Geothlypis trichas           Common Yellowthroat
## 47               Anas platyrhynchos                       Mallard
## 48              Agelaius phoeniceus          Red-winged Blackbird
## 49                 Pipilo maculatus                Spotted Towhee
## 50        Pheucticus melanocephalus         Black-headed Grosbeak
## 51       Stelgidopteryx serripennis Northern Rough-winged Swallow
## 52              Contopus sordidulus            Western Wood-Pewee
## 53                 Circus hudsonius              Northern Harrier
## 54                   Ardea herodias              Great Blue Heron
## 55             Salpinctes obsoletus                     Rock Wren
## 56            Archilochus alexandri     Black-chinned Hummingbird
## 57               Passerina caerulea                 Blue Grosbeak
## 58                  Aythya collaris              Ring-necked Duck
## 59                 Spatula clypeata             Northern Shoveler
## 60                     Vireo bellii                  Bell's Vireo
## 61                Troglodytes aedon                    House Wren
## 62               Turdus migratorius                American Robin
## 63                     Vireo gilvus                Warbling Vireo
## 64          Geococcyx californianus            Greater Roadrunner
## 65               Accipiter cooperii                 Cooper's Hawk
## 66                    Piranga rubra                Summer Tanager
## 67             Eremophila alpestris                   Horned Lark
## 68               Oxyura jamaicensis                    Ruddy Duck
## 69              Podilymbus podiceps             Pied-billed Grebe
## 70    Xanthocephalus xanthocephalus       Yellow-headed Blackbird
## 71               Toxostoma crissale              Crissal Thrasher
## 72               Sitta carolinensis       White-breasted Nuthatch
## 73                   Icteria virens          Yellow-breasted Chat
## 74           Aphelocoma woodhouseii         Woodhouse's Scrub-Jay
## 75             Myiarchus tyrannulus      Brown-crested Flycatcher
## 76                 Mareca americana               American Wigeon
## 77               Spatula cyanoptera                 Cinnamon Teal
## 78                 Passerina amoena                Lazuli Bunting
## 79                   Melozone fusca                 Canyon Towhee
## 80                   Plegadis chihi              White-faced Ibis
## 81                   Calypte costae           Costa's Hummingbird
## 82             Setophaga nigrescens   Black-throated Gray Warbler
## 83                Melospiza melodia                  Song Sparrow
## 84               Calidris minutilla               Least Sandpiper
## 85               Sturnella neglecta            Western Meadowlark
## 86              Catherpes mexicanus                   Canyon Wren
## 87                Catharus guttatus                 Hermit Thrush
## 88           Tachycineta thalassina          Violet-green Swallow
## 89               Dryobates villosus              Hairy Woodpecker
## 90                  Sialia mexicana              Western Bluebird
## 91                     Spinus pinus                   Pine Siskin
## 92                  Hirundo rustica                  Barn Swallow
## 93                 Anthus rubescens                American Pipit
## 94                Bucephala albeola                    Bufflehead
## 95        Passerculus sandwichensis              Savannah Sparrow
## 96              Pooecetes gramineus                Vesper Sparrow
## 97             Chondestes grammacus                  Lark Sparrow
## 98               Actitis macularius             Spotted Sandpiper
## 99              Tyrannus vociferans             Cassin's Kingbird
## 100             Tachycineta bicolor                  Tree Swallow
## 101                  Vireo plumbeus               Plumbeous Vireo
## 102           Cistothorus palustris                    Marsh Wren
## 103                Pipilo chlorurus           Green-tailed Towhee
## 104               Icterus bullockii              Bullock's Oriole
## 105                Sturnus vulgaris             European Starling
## 106              Geothlypis tolmiei        MacGillivray's Warbler
## 107                     Anas crecca             Green-winged Teal
## 108                Bubo virginianus              Great Horned Owl
## 109                 Mareca strepera                       Gadwall
## 110          Chordeiles acutipennis              Lesser Nighthawk
## 111            Sphyrapicus nuchalis           Red-naped Sapsucker
## 112                      Ardea alba                   Great Egret
## 113            Himantopus mexicanus            Black-necked Stilt
## 114                      Anas acuta              Northern Pintail
## 115                   Sitta pygmaea                Pygmy Nuthatch
## 116         Leiothlypis ruficapilla             Nashville Warbler
## 117         Melanerpes formicivorus              Acorn Woodpecker
## 118             Polioptila caerulea         Blue-gray Gnatcatcher
## 119                Porzana carolina                          Sora
## 120              Icterus cucullatus                 Hooded Oriole
## 121        Petrochelidon pyrrhonota                 Cliff Swallow
## 122               Selasphorus rufus            Rufous Hummingbird
## 123              Anser caerulescens                    Snow Goose
## 124                  Aythya affinis                  Lesser Scaup
## 125             Empidonax hammondii          Hammond's Flycatcher
## 126                   Columba livia                   Rock Pigeon
## 127          Euphagus cyanocephalus            Brewer's Blackbird
## 128            Podiceps nigricollis                   Eared Grebe
## 129            Aeronautes saxatalis          White-throated Swift
## 130              Aythya valisineria                    Canvasback
## 131              Accipiter striatus            Sharp-shinned Hawk
## 132               Pandion haliaetus                        Osprey
## 133             Nannopterum auritum      Double-crested Cormorant
## 134            Psaltriparus minimus                       Bushtit
## 135         Selasphorus platycercus      Broad-tailed Hummingbird
## 136                  Calidris mauri             Western Sandpiper
## 137              Tringa melanoleuca            Greater Yellowlegs
## 138           Baeolophus wollweberi              Bridled Titmouse
## 139         Recurvirostra americana               American Avocet
## 140         Limnodromus scolopaceus         Long-billed Dowitcher
## 141           Aphelocoma wollweberi                   Mexican Jay
## 142              Larus delawarensis              Ring-billed Gull
## 143                Falco peregrinus              Peregrine Falcon
## 144       Artemisiospiza nevadensis             Sagebrush Sparrow
## 145       Aechmophorus occidentalis                 Western Grebe
## 146               Certhia americana                 Brown Creeper
## 147              Empidonax wrightii               Gray Flycatcher
## 148             Setophaga townsendi            Townsend's Warbler
## 149           Empidonax oberholseri              Dusky Flycatcher
## 150             Butorides virescens                   Green Heron
## 151             Colaptes chrysoides                Gilded Flicker
## 152               Megaceryle alcyon             Belted Kingfisher
## 153              Empidonax traillii             Willow Flycatcher
## 154           Cynanthus latirostris      Broad-billed Hummingbird
## 155             Phalaropus tricolor            Wilson's Phalarope
## 156             Haemorhous cassinii                Cassin's Finch
## 157             Cyanocitta stelleri                 Steller's Jay
## 158            Empidonax difficilis      Pacific-slope Flycatcher
## 159              Gallinago delicata                Wilson's Snipe
## 160             Baeolophus ridgwayi              Juniper Titmouse
## 161             Myadestes townsendi          Townsend's Solitaire
## 162               Falco columbarius                        Merlin
## 163               Icterus parisorum                Scott's Oriole
## 164              Aimophila ruficeps        Rufous-crowned Sparrow
## 165            Oreoscoptes montanus                 Sage Thrasher
## 166                 Rallus limicola                 Virginia Rail
## 167                Contopus cooperi        Olive-sided Flycatcher
## 168              Bucephala clangula              Common Goldeneye
## 169             Bombycilla cedrorum                 Cedar Waxwing
## 170                 Riparia riparia                  Bank Swallow

Now we need to aggregate the BirdNET output into one master table for us to interpret

birdnet_format(results.directory = output,
               timezone = 'MST') # Double Check due to timezone changes

results_table <- birdnet_gather(results.directory = output,
                  formatted = TRUE)

To export the data in an excel table that contains both the BirdNET results and the potential species, run the following lines of code with the openxlsx library to create an excel workbook with both tables of information on each sheet:

workbook <- createWorkbook() results <- addWorksheet(workbook, "BirdNET Results") Spec <- addWorksheet(workbook, "Potential Species in Project") writeData(workbook, Spec, spec_list) writeData(workbook, results, results_table) saveWorkbook(workbook, glue("./results_table/{SiteName}_results_table.xlsx"), overwrite = TRUE)

Below are the first 5 results from BirdNET from our Bird-feeder recordings.

recordingID filepath start end scientific_name common_name confidence lat lon week overlap sensitivity min_conf species_list model verify timezone
SMM07526_20221213_090202.wav C:/Users/jkauphusman/Desktop/Scripts/Bird_Scanner/data/SMM07526_20221213_090202.wav 18 21 Haemorhous mexicanus House Finch 0.9594 33.2736 -111.8298 50 0 1 0.75 None BirdNET_GLOBAL_2K_V2.1_Model_FP32.tflite NA MST
SMM07526_20221213_090202.wav C:/Users/jkauphusman/Desktop/Scripts/Bird_Scanner/data/SMM07526_20221213_090202.wav 36 39 Haemorhous mexicanus House Finch 0.8328 33.2736 -111.8298 50 0 1 0.75 None BirdNET_GLOBAL_2K_V2.1_Model_FP32.tflite NA MST
SMM07526_20221213_090202.wav C:/Users/jkauphusman/Desktop/Scripts/Bird_Scanner/data/SMM07526_20221213_090202.wav 6 9 Haemorhous mexicanus House Finch 0.9548 33.2736 -111.8298 50 0 1 0.75 None BirdNET_GLOBAL_2K_V2.1_Model_FP32.tflite NA MST
SMM07526_20221213_090202.wav C:/Users/jkauphusman/Desktop/Scripts/Bird_Scanner/data/SMM07526_20221213_090202.wav 66 69 Haemorhous mexicanus House Finch 0.8793 33.2736 -111.8298 50 0 1 0.75 None BirdNET_GLOBAL_2K_V2.1_Model_FP32.tflite NA MST
SMM07526_20221213_090202.wav C:/Users/jkauphusman/Desktop/Scripts/Bird_Scanner/data/SMM07526_20221213_090202.wav 81 84 Haemorhous mexicanus House Finch 0.9696 33.2736 -111.8298 50 0 1 0.75 None BirdNET_GLOBAL_2K_V2.1_Model_FP32.tflite NA MST

Quick Tip, if you run bird-scanner.R remember to either clear your results-directory folder if you run the script again to the same folder.

Again, all these steps on running BirdNET on your ARU calls should be ran through the bird-scanner.R script provided in the Bird-Scanner Repository.

7. Check Predictions

Let’s say you ran BirdNET, and it predicted a species like “House finch” and you wanted to make sure that prediction was correct, here in the Bird-Scanner Workflow repository, I wrote some functions to extract a segment of the audio file when exactly in the given audio segment the model predicted the species and how to convert the audio into a spectrogram. To see how I typically run this code, in the Bird-Scanner Repository under the code folder check out the bird_checker.R script, which will give you a tutorial of how to verify the model’s predictions. So, if you want to look at just the “House Finch” calls you can extract those results.

### What species or observation do you want to verify?

species <- "House Finch"

# create a sub table of the calls you want to investigate, lets just take the first two entries
verify <- results_table[1:2] %>% 
  filter(common_name == glue("{species}"))

Then using the bird_verify function I developed for this workflow, you can output the audio segments of when the model predicted “House Finch” to the checker folder in the repository, and quickly listen to the audio segments.

# Read in the bird_verify function
source("./code/bird_verify.R")
# execute the function to the sub-table of house finch calls
bird_verify(verify)
# now check the outputs in the checker folder

Here is the example of the audio segment of the first predicted House Finch call

As you can see the model predicted correctly. If you wanted further verification, using the bird_checker.R script in the code folder you can output the spectrograms of the predicted audio segment using the bird_spec function. This function will create spectrograms for all the verify species you have aggregated and output the spectrograms in PNG files in the spectrograms folder of the Bird-Scanner Repository.

# Read in the bird_verify function
source("./code/bird_spec.R")
# execute the function to the sub-table of house finch calls
bird_spec(verify)
# now check the outputs in the checker folder

And there is the first prediction of the house finch in a spectrogram of when the model made the prediction. Just some backrground information, the function buffers out the predicted call by one second at the start and end of the prediction, so below in the spectrogram the model identified the call at seconds 1-4s.

Before you run bird_checker.R again, make sure to delete the wav and png files in both the checker and spectrograms folder.

8. Final Thoughts

With that, I leave you with a step-by-step tutorial of the Bird-Scanner workflow, which will give you everything you need to set up your workflow with the Bird-Scanner Repository.

I hope you will find the great applicability of using BirdNET for your avian species analyses, including the use of this workflow for various avian ESA species surveys.

If you have any questions feel free to leave a comment in the issues section of the Bird-Scanner Repository or contact me directly.

THANK YOU!!